/**
 * @file     reverseString.js
 * @brief    [344. 反转字符串](https://leetcode.cn/problems/reverse-string/description/)
 * @author   Zhu
 * @date     2023-02-12 15:55
 */

/**
 * @param {character[]} s
 * @return {void} Do not return anything, modify s in-place instead.
 */
var reverseString = function (s) {
    let i = 0;
    let j = s.length - 1;
    while (i < j) {
        swap(i++, j--);
    }

    function swap(i, j) {
        let temp = s[i];
        s[i] = s[j];
        s[j] = temp;
    }
};
